
h1 = {'玩游戏', '看电视', '听音乐'}
h2 = {'唱歌', '购物', '看电视'}
h3 = {'玩游戏', '听音乐'}
lst = [{'name':'小明', "hobby":h1},
       {'name':'小红', "hobby":h2},
       {'name':'小刚', "hobby":h3}]
# 预测他们之间谁和谁会成为好朋友
for i in range(len(lst)):
    for ll in range(i+1,len(lst)):
        if lst[i].get("hobby")&lst[ll].get("hobby"):
            print(f'{lst[i].get("name")}和{lst[ll].get("name")}会成为好朋友')

